<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>


        // 取数字
        //   取整数   parseInt()
        //   取浮点数   parseFloat()



        var x = '24px24' ;

        // 取整数
        x = parseInt(x) ;

        document.write(x) ;   // 24


        var y = 3.14159 ;
        y = parseInt(y) ;   // 3

        document.write(y) ;


        var z = '24.5.5px' ;
        z = parseFloat(z) ;
        document.write(z) ;

    </script>
    
</body>
</html>